<style>
 span.publish {
    background-image: url("/images/admin/tick.png");
}
span.state {
    display: inline-block;
    height: 16px;
    width: 16px;
}
</style>
<script language="javascript">
   $(document).ready(function() {
    $('#homepagetable').dataTable( {
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
     "aaSorting": [[ 0, "desc" ]]
    } );
} );

</script>
<?php
if($this->stat == "added")
{
?>
	<div id="success_msg">homepage content successfully saved</div>
<?php
} else if ($this->stat == "updated") {
?>
	<div id="success_msg">homepage content successfully updated</div>
<?php
} else if ($this->stat == "deleted") {
?>
	<div id="success_msg">homepage content successfully deleted</div>
<?php
}
?>
<?php
echo $this->adminToolBar('homepage', 'index', '/admin/homepage/add/', '/admin/homepage/edit/', '/admin/homepage/delete/', '');
?>

<table id="homepagetable" width="100%" class="adminlist">
	<thead>
		<tr>	
			<th width="3%">ID</th>
			<th width="25%">Title</th>
			<th width="35%">Descriptione</th>
			<th width="5%">Status</th>
			<th width="5%">Section</th>
			<th width="3%">Hits</th>
			<th width="3%">&nbsp;</th>
			<th width="3%">&nbsp;</th>
		</tr>	
	</thead>              
    <tbody>
		<?php 
			foreach($this->homepagearr as $homepagearr):	
	  			if($homepagearr['isactive'] == 1)
				{
					$status = "<img src='/images/admin/publish.png' title='unpublish' />";
				} else {
					$status = "<img src='/images/admin/publish_x.png' title='publish' />";
				}	
	  	?>
	    <tr>
	    	<td><?php echo $homepagearr['id']; ?></td>	        
			<td><a href="/admin/homepage/edit/id/<?php echo $homepagearr["id"] ?>"><?php echo $homepagearr["title"] ?></a></td>
			<td><?php echo substr(stripslashes($homepagearr['content']), 0, 200) . "..."; ?></td>
			<td><a href="javascript: void(0);" onclick="changehomepageStatus('<?php echo $homepagearr['id']; ?>')"><?php echo $status; ?></a></td>
			<td><?php echo $homepagearr["section"] ?></td>
			<td><?php echo $homepagearr["hits"] ?></td>
			<td><a href="/admin/homepage/edit/id/<?php echo $homepagearr["id"] ?>"><img src="/images/admin/icons/edit.gif" width="15" height="15" /></a></td>
			<td><a href="javascript: void(0);" onclick="deleteHomeContent('<?php echo $homepagearr['id']; ?>')"><img src="/images/admin/icons/delete.gif" width="18" height="18" /></a></td>
		</tr>      
		<?php 
			endforeach;
		?>
	</tbody>
</table>